package com.wangx.sell.managerweb;


import com.wangx.sell.managerpojo.TbItem;
import com.wangx.sell.managerservice.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @ClassName ItemController
 * @Author wangx
 * @Date 2019/3/20 16:07
 * @Vsersion 1.0
 * @Description TODO
 **/
@Controller
public class ItemController {

    @Autowired
    private ItemService itemService;

    @RequestMapping("/item/{itemId}")
    public String   getItemById(@PathVariable Long itemId, Model model) {
        TbItem item = itemService.getItemById(itemId);
        model.addAttribute("item", item);
        return "item-test";
    }
}
